import { PutUserStateParam, UserListParam } from "@Tea/model"
import { UserRepository } from "../repo/UserRepository"

export class UserMangeContext {
  private static inst: UserMangeContext
  private repo: UserRepository = UserRepository.getInstance()

  // 单例
  public static getInstance() {
    if (!UserMangeContext.inst) {
      UserMangeContext.inst = new UserMangeContext()
    }

    return UserMangeContext.inst
  }

  getUserList(params: UserListParam ,type: "admin" | "user" ) {
    return this.repo.getUserList(params, type)
  }

  putUserState(params: PutUserStateParam) {
    return this.repo.putUserState(params)
  }
}